package org.ihelpuoo.lang;

public class CharUtils
{
	/**
	 * Test a char can by class name or not. 
	 * Only "0~9", "A~Z", "a~z", "-", "_" can not be word boundery
	 * 
	 * @param c
	 * @return boolean.
	 */
	public static boolean isWordBoundery(int c)
	{
		if (c == 39)
			return false;
		if (c >= 0 && c <= 47)
			return true;
		if (c >= 58 && c <= 64)
			return true;
		if (c >= 91 && c <= 96)
			return true;
		if (c >= 123 && c <= 126)
			return true;
		return false;
	}

	public static boolean is0A(int c)
	{
		if (c == 0x0A)
			return true;
		return false;
	}

	public static boolean is0D(int c)
	{
		if (c == 0x0D)
			return true;
		return false;
	}

	public static boolean isLineEndl(int c)
	{
		if (c == 0x0D || c == 0x0A || c == 0)
			return true;
		return false;
	}

	public static boolean isFileEndl(int c)
	{
		return 0 == c;
	}

	public static boolean isWhiteSpace(int c)
	{
		if (c <= 0x20 && c >= 0)
			return true;
		return false;
	}

	public static boolean isNumber(int c)
	{
		return c >= 48 && c <= 57;
	}
}
